package com.lgq.cfw.controller.permission;

import com.lgq.cfw.bean.message.Message;
import com.lgq.cfw.service.RoleAndPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Lin
 * @date 2019-02-10 18:57
 **/
@RestController
@RequestMapping("/permission/roleAndPermission")
public class RoleAndPermissionController {

  @Autowired
  RoleAndPermissionService roleAndPermissionService;

  /**
   * 更新某个角色的权限
   * @param roleId 角色id
   * @param permissionIdString 被选中的权限id字符串
   * @return 处理结果
   */
  @RequestMapping(value = "/update",method = RequestMethod.POST)
  public Message update(@RequestParam("roleId")Integer roleId,
      @RequestParam(value = "permissionIdString") String permissionIdString){
    roleAndPermissionService.update(roleId,permissionIdString);
    return Message.success("处理成功",null);
  }
}
